TwainPRO 9 for ActiveX - User Guide > How To > Negotiate Capabilities > Set Capabilities |
Once a capability negotiation session has been initiated (OpenSession has been called), the Data Source capabilities can be modified to desired settings.
Capabilities can only be modified, or set, after a TWAIN Session has been opened (OpenSession), and prior to initiating the scanning session (StartSession). |
First specify the capability to be set, by setting the Capability property.
To determine whether the selected Capability is supported by the Data Source, read the CapSupported property.
Set the CapTypeOut property to specify the type of container used to pass information from TwainPRO™ to the Data Source.
The relevant properties to set for the capability depend on the specified CapTypeOut. TWAIN defines four types of containers to negotiate values between the application (TwainPRO) and the Source:
TWON_ONEVALUE: The current value is returned
Relevant Properties To Set: CapValueOut
TWON_ENUM: A list of legal values along with the current and default values are returned
Relevant Properties To Set: CapValueOut, CapNumItemsOut, CapItemOut
TWON_RANGE: A range of legal values along with the current and default values are returned
Relevant Properties To Set: CapValueOut, CapMinOut, CapMaxOut
TWON_ARRAY: A list of values is returned
Relevant Properties To Set: CapNumItemsOut, CapItemOut
Once the properties are set, the SetCapOut method must be called to negotiate the new values.
VB Example |
Copy Code
|
---|---|
' This code demonstrates setting a single value using the TWON_ONEVALUE container ' Let's make sure the user entered valid data If False = IsNumeric(EdtCurrent.Text) Then MsgBox "You must enter a real number for the new current value." End If TwainPRO.CapTypeOut = TWON_ONEVALUE TwainPRO.CapValueOut = EdtCurrent.Text TwainPRO.SetCapOut |
VB Example |
Copy Code
|
---|---|
' The following code will request that the Data Source only allow resolutions in the range of 100 to 400 dpi (assuming the ICAP_UNITS cap is set to inches).
TwainPRO.CapTypeOut = TWON_RANGE
TwainPRO.CapValueOut = 100
TwainPRO.CapMinOut = 100
TwainPRO.CapMaxOut = 400
TwainPRO.SetCapOut
|